services:
  neo4j:
    image: neo4j
    ports:
      - 7474:7474
      - ${NEO4J_PORT}:${NEO4J_PORT}
    environment:
      - NEO4J_AUTH=${NEO4J_USER}/${NEO4J_PASSWORD}
    volumes:
      - neo4j:/data
    healthcheck:
      test: wget http://localhost:7474 || exit 1
      interval: 2s
      timeout: 2s
      retries: 60

  rabbitmq:
    container_name: rabbitmq
    image: rabbitmq:3.12-management
    hostname: rabbitmq
    environment:
      - RABBITMQ_DEFAULT_USER=${RABBITMQ_DEFAULT_USER}
      - RABBITMQ_DEFAULT_PASS=${RABBITMQ_DEFAULT_PASS}
    ports:
      - 15672:15672
      - ${RABBITMQ_PORT}:${RABBITMQ_PORT}
    healthcheck:
      test: rabbitmq-diagnostics -q ping
      interval: 2s
      timeout: 2s
      retries: 100
    restart: always

  gash:
    container_name: gash
    image: gooddelo/gash
    env_file:
      - .env
    command:
      faststream run src.api.amqp.main:app
    volumes:
      - ./examples/:/gash/policy/
    depends_on:
      rabbitmq:
        condition: service_healthy
      neo4j:
        condition: service_healthy

volumes:
  neo4j: